import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:school_safe_teacher/resourse/app_colors.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(IndexState state, Dispatch dispatch, ViewService viewService) {
  return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle.dark,
      child: Scaffold(
        backgroundColor: Colors.white,
        body: Container(
          child: state.widgetList[state.select],
        ),
        bottomNavigationBar: BottomNavigationBar(
          currentIndex: state.select,
          onTap: (int value) {
            state..select = value;
            dispatch(IndexActionCreator.onAction());
          },
          fixedColor: AppColors.deepTextColor,
          selectedLabelStyle: TextStyle(color: AppColors.deepTextColor,fontSize: 10,fontWeight: FontWeight.normal),
          unselectedLabelStyle: TextStyle(color: AppColors.smallTextColor,fontSize: 10,fontWeight: FontWeight.normal),
          type: BottomNavigationBarType.fixed,
          items: [
            BottomNavigationBarItem(
                label: "首页",
                icon: Image.asset(
                  "images/home_unselect_icon@2x.png",
                  width: 22,
                  height: 22,
                ),
                activeIcon: Image.asset(
                  "images/home_select_icon@2x.png",
                  width: 22,
                  height: 22,
                )),
            BottomNavigationBarItem(
                label: "我的",
                icon: Image.asset(
                  "images/me_unselect_icon@2x.png",
                  width: 22,
                  height: 22,
                ),
                activeIcon: Image.asset(
                  "images/me_select_icon@2x.png",
                  width: 22,
                  height: 22,
                )),
          ],
        ),
      ));
}
